package com.caidanxiaoyuan.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import com.caidanxiaoyuan.model.Category;
import com.caidanxiaoyuan.service.CategoryService;
import com.caidanxiaoyuan.util.JsonUtil;
import com.caidanxiaoyuan.util.ResponseUtil;
import com.github.pagehelper.Page;

@Controller
@CrossOrigin
@RequestMapping("/category")
public class CategoryController {

	@Autowired
	private CategoryService categoryService;
	/**
	 * 
	* @Description: 获取分类  
	* @author zealot
	* @param  
	* @return void    
	* @version 创建时间：2017年3月6日 下午5:56:19  
	* @throws
	 */
	@RequestMapping("/")
	public void list(Page<Category> page,HttpServletResponse response){
		ResponseUtil.result(response, JsonUtil.toJsonStr(categoryService.selectAll(page)));
	}
}
